<template>
  <div class="main">
    <div class="img">
      <img src="../../../../assets/img/main/qiandao.png" alt="" />
    </div>
    <div class="shuoming">
      {{ msg }}
    </div>
    <div class="btn" @click="goqiandao()">开始签到</div>
  </div>
</template>
<script>
import { getqiandaomsgApi } from "@/service/api.js";
import { Field } from "vant";
import { Cell, CellGroup } from "vant";
import { Switch } from "vant";
import { Picker } from "vant";
import { Popup } from "vant";
import { Toast, Dialog, NoticeBar } from "vant";
export default {
  name: "yindao",
  data() {
    return {
      hosid: "",
      msg: ""
    };
  },
  components: {},
  created() {
    // let hosqianid = localStorage.getItem("hosqianid");
    // if (hosqianid) {
    //   this.hosid = hosqianid;
    // } else {
    this.hosid = this.getUrlVars()["signHospitalId"];
    localStorage.setItem("hosqianid", this.hosid);

    // }
    window.localStorage.removeItem("qianname");
    window.localStorage.removeItem("qianphone");
    window.localStorage.removeItem("qiancard");

    this.getmsg();
  },
  methods: {
    goqiandao() {
      this.$router.push({
        name: "qiandao"
      });
    },
    getmsg() {
      getqiandaomsgApi({
        signHospitalId: this.hosid
      }).then(res => {
        console.log(res);
        if (res.code == 4000) {
          this.msg = res.data.tipsMsg;
        }
      });
    },
    getUrlVars() {
      var vars = {};
      var parts = window.location.href.replace(
        /[?&]+([^=&]+)=([^#]*)/gi,
        function(m, key, value) {
          vars[key] = value;
        }
      );
      return vars;
    }
  }
};
</script>
<style lang="scss" scoped>
.main {
  width: 100%;
  background: #fff;
  .shuoming {
    width: 80%;
    margin: 0 auto;
    font-size: 0.35rem;
    color: #333;
    line-height: 0.6rem;
  }
  .img {
    width: 80%;
    margin: 0 auto;
    padding-top: 2rem;

    img {
      width: 100%;
    }
  }
  .btn {
    width: 30%;
    font-size: 0.4rem;
    color: #fff;
    margin: 0 auto;
    margin-top: 0.6rem;
    line-height: 1rem;
    background-color: #3c7dff;
    border-radius: 25px;
    text-align: center;
  }
}
</style>
